package learn_bouncycastle.security;

import java.io.UnsupportedEncodingException;
import java.util.Base64;

public class SecBase64 {

	public static void main(String[] args) throws UnsupportedEncodingException {
		String s = "abc";

		String encodeStr = Base64.getEncoder().encodeToString(s.getBytes("utf8"));
		// YWJj
		System.out.println(encodeStr);

		byte[] decodeBytes = Base64.getDecoder().decode(encodeStr);
		System.out.println(new String(decodeBytes, "utf8"));
	}

}
